<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>chain_struct</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab function</center>
    <div align="right">Last update : September 1996</div>
    <p>
      <b>chain_struct</b> -  chained structure from adjacency lists of a graph</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[fe,che,fn,chn] = chain_struct(g)  </tt>
      </dd>
      <dd>
        <tt>[fe,che,fn,chn] = chain_struct(lp,la,ls)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>g</b>
        </tt>: graph list</li>
      <li>
        <tt>
          <b>lp</b>
        </tt>: row vector, pointer array of the adjacency lists description of the graph  (its size is the number of nodes of the graph + 1)</li>
      <li>
        <tt>
          <b>la</b>
        </tt>: row vector, arc array of the adjacency lists description of the graph  (its size is the number of edges of the graph)</li>
      <li>
        <tt>
          <b>ls</b>
        </tt>: row vector, node array of the adjacency lists description of the graph  (its size is the number of edges of the graph)</li>
      <li>
        <tt>
          <b>fe</b>
        </tt>: row vector of the numbers of the first edges starting from nodes (its size is the number of nodes of the graph)</li>
      <li>
        <tt>
          <b>che</b>
        </tt>: row vector of the numbers of the chained edges  (its size is the number of edges of the graph)</li>
      <li>
        <tt>
          <b>fn</b>
        </tt>: row vector of the numbers of the first nodes reached by the edges of  <tt>
          <b>fe</b>
        </tt> (its size is the number of nodes of the graph)</li>
      <li>
        <tt>
          <b>chn</b>
        </tt>: row vector of the nodes reached by the edges of <tt>
          <b>che</b>
        </tt>
      </li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>chain_struct</b>
      </tt> computes the row vectors of the edge chained structure 
    description of the graph <tt>
        <b>g</b>
      </tt>.
    It is also possible to give directly <tt>
        <b>chain_struct</b>
      </tt> the adjacency lists of
    the graph. This is more efficient if the adjacency lists are already
    available since <tt>
        <b>chain_struct</b>
      </tt> uses them to make computations.</p>
    <p>
    The vectors <tt>
        <b>fe</b>
      </tt>, <tt>
        <b>che</b>
      </tt>, <tt>
        <b>fn</b>
      </tt> and <tt>
        <b>chn</b>
      </tt> describe the
    chained structure in the following way:</p>
    <p>
      <tt>
        <b>fe(i))</b>
      </tt> is the number of the first edge starting from node i</p>
    <p>
      <tt>
        <b>che(fe(i))</b>
      </tt> is the number of the second edge starting from
    node i, <tt>
        <b>che(che(fe(i)))</b>
      </tt> is the number of the third edge starting from
    node i and so on until the value is 0</p>
    <p>
      <tt>
        <b>fn(i)</b>
      </tt> is the number of the first node reached from node i</p>
    <p>
      <tt>
        <b>ch(i)</b>
      </tt> is the number of the node reached by edge <tt>
        <b>che(i)</b>
      </tt>.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

ta=[1 1 2 3 5 4 6 7 7 3 3 8 8 5];
he=[2 3 5 4 6 6 7 4 3 2 8 1 7 4];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[116 231 192 323 354 454 305 155];
g('node_y')=[118 116 212 219 117 185 334 316];
show_graph(g);
[fe,che,fn,chn] = chain_struct(g)
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="adj_lists.htm">
        <tt>
          <b>adj_lists</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="graph_2_mat.htm">
        <tt>
          <b>graph_2_mat</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
